package library;

import android.content.Context;
import android.support.annotation.NonNull;

import library.http.HttpUtils;
import library.logger.ILogger;
import library.logger.Logger;
import library.utils.DisplayUtil;
import library.utils.Utils;

/**
 * Created by Mr.Fan on 2016-6-28.
 */
public class Library {

    private static Context context;

    public static void init(@NonNull Context context, boolean debug) {
        if (Library.context != null && Utils.isRemoteProcess(context)) {
            return;
        }
        context = context != null ? context.getApplicationContext() : null;
        Library.context = context;
        Logger.init(context, debug);
        HttpUtils.init(context);
        HttpUtils.setLogger(new ILogger() {
            @Override
            public void onOutput(Object log) {
                Logger.debug(log);
            }
        });
        DisplayUtil.init(context);

        //
        Logger.debug(Utils.getHandSetInfo(context));
    }

    public static Context getContext() {
        return context;
    }
}
